package com.zsr.chapter04.servlet;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @Author zsr
 * @Description 请求转发
 * @Version 1.0
 */
public class ReqServlet3 extends HttpServlet {
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        //将用户id存入request属性
        request.setAttribute("userId","001");
        //请求转发
        request.getRequestDispatcher("/reqServlet4").forward(request,response);
    }
}
